|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfurny.ga.util.FurnitureUtil
public final class FurnitureUtil
Utility class for handling furniture similarities.
Nested Class Summary | |
---|---|
private static class |
FurnitureUtil.FurniturePair
Sorted pair for caching similarities. |
Field Summary | |
---|---|
private static java.util.logging.Logger |
LOGGER
|
private static java.util.Map<FurnitureUtil.FurniturePair,java.lang.Double> |
SIMILARITY_MAP
This map caches all distance calculations, so they are reusable. |
Constructor Summary | |
---|---|
private |
FurnitureUtil()
Instantiation is not allowed. |
Method Summary | ||
---|---|---|
private static
|
createSortedMap(java.util.Map<Furniture,T> passedMap)
Creates a descending sorted map from the given map. |
|
static float |
getCosts(FurnLayoutIndividual ind)
Calculates the total costs of a furniture layout. |
|
private static double |
getManhattanDistance(double w1,
double w2,
double l1,
double l2)
Calculates the manhattan distance of width and length. |
|
static Furniture |
getOtherFurnitureBySimilarityDistance(Furniture f1,
int dist)
Gets the furniture with a distance inside of the given width. |
|
static Furniture |
getOtherFurnitureBySimilarityRoulette(Furniture f1)
This method does a roulette selection on the sorted map of similarities (rank map) to find a second furniture. |
|
static double |
getSimilarity(Furniture furn1,
Furniture furn2)
Calculates the similarity between two furnitures by their tags. |
|
private static double |
getSimilarityImpl(Furniture furn1,
Furniture furn2)
Calculates the similarity between two furnitures by their tags. |
|
static java.util.Map<Furniture,java.lang.Double> |
getSimilarityRankMap(Furniture furn1,
java.util.List<Furniture> allFurnitures)
Creates a sorted map of furnitures and their similarities to the given furniture. |
|
private static double |
getTagSimilarity(Furniture furn1,
Furniture furn2)
Calculates the similarity between two sets of tags. |
|
static void |
main(java.lang.String[] args)
Main method for test purposes. |
|
private static Furniture |
rouletteImpl(java.util.Map<Furniture,java.lang.Double> map)
Roulette algorithm for maps. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.util.logging.Logger LOGGER
private static final java.util.Map<FurnitureUtil.FurniturePair,java.lang.Double> SIMILARITY_MAP
Constructor Detail |
---|
private FurnitureUtil()
Method Detail |
---|
public static double getSimilarity(Furniture furn1, Furniture furn2)
furn1
- The first furniture.furn2
- The second furniture.
getSimilarityImpl(Furniture, Furniture)
private static double getSimilarityImpl(Furniture furn1, Furniture furn2)
furn1
- The first furniture.furn2
- The second furniture.
getSimilarity(Furniture, Furniture)
private static double getManhattanDistance(double w1, double w2, double l1, double l2)
w1
- Width 1w2
- Width 2l1
- Length 1l2
- Length 2
private static double getTagSimilarity(Furniture furn1, Furniture furn2)
furn1
- The first furniture.furn2
- The second furniture.
getSimilarity(Furniture, Furniture)
public static java.util.Map<Furniture,java.lang.Double> getSimilarityRankMap(Furniture furn1, java.util.List<Furniture> allFurnitures)
furn1
- The furniture to calculate similarities for.allFurnitures
- All other furnitures.
private static <T extends java.lang.Comparable<T>> java.util.Map<Furniture,T> createSortedMap(java.util.Map<Furniture,T> passedMap)
T
- Generic type parameterpassedMap
- The map to create the sorted map from.
public static Furniture getOtherFurnitureBySimilarityRoulette(Furniture f1)
f1
- Furniture
public static Furniture getOtherFurnitureBySimilarityDistance(Furniture f1, int dist)
f1
- The furniture.dist
- The width where the other furniture should be inside.
private static Furniture rouletteImpl(java.util.Map<Furniture,java.lang.Double> map)
map
- The map of furnitures and similarities.
public static float getCosts(FurnLayoutIndividual ind)
ind
- The individual.
public static void main(java.lang.String[] args)
args
- No arguments.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |